package com.zhihesj.anan.system.controller;


import cn.hutool.core.bean.BeanUtil;
import com.zhihesj.anan.message.Message;
import com.zhihesj.anan.system.entity.DictData;
import com.zhihesj.anan.system.service.DictDataService;
import com.zhihesj.anan.system.vo.DictDataVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 字典数据表 前端控制器
 * </p>
 *
 * @author anan
 * @since 2020-07-31
 */
@RestController
@RequestMapping("/system/dict-data")
public class DictDataController {

    @Autowired
    private DictDataService dictDataService;

    @GetMapping("/getDictDataList")
    public Message getDictTypeList(DictDataVo dictDataVo){
        System.out.println(dictDataVo);
        Map<String, Object> stringObjectMap = BeanUtil.beanToMap(dictDataVo, false, true);
        List<DictData> dictData=null;
        if (stringObjectMap.isEmpty()) {
            dictData = dictDataService.list();
        } else {
            dictData = dictDataService.list();
        }
        return Message.success(dictData);
    }

}
